/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author user
 */
@Entity
@Table(name = "weatherinformation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Weatherinformation.findAll", query = "SELECT w FROM Weatherinformation w"),
    @NamedQuery(name = "Weatherinformation.findById", query = "SELECT w FROM Weatherinformation w WHERE w.id = :id"),
    @NamedQuery(name = "Weatherinformation.findByDateTime", query = "SELECT w FROM Weatherinformation w WHERE w.dateTime = :dateTime"),
    @NamedQuery(name = "Weatherinformation.findByStatus", query = "SELECT w FROM Weatherinformation w WHERE w.status = :status"),
    @NamedQuery(name = "Weatherinformation.findByLocation", query = "SELECT w FROM Weatherinformation w WHERE w.location = :location")})
public class Weatherinformation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "DateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateTime;
    @Size(max = 255)
    @Column(name = "Status")
    private String status;
    @Size(max = 155)
    @Column(name = "Location")
    private String location;
    @JoinColumn(name = "WeatherNotification_ID", referencedColumnName = "ID")
    @ManyToOne
    private Weathernotification weatherNotificationID;
    @OneToMany(mappedBy = "weatherInformationID")
    private Collection<Event> eventCollection;

    public Weatherinformation() {
    }

    public Weatherinformation(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDateTime() {
        return dateTime;
    }

    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public Weathernotification getWeatherNotificationID() {
        return weatherNotificationID;
    }

    public void setWeatherNotificationID(Weathernotification weatherNotificationID) {
        this.weatherNotificationID = weatherNotificationID;
    }

    @XmlTransient
    public Collection<Event> getEventCollection() {
        return eventCollection;
    }

    public void setEventCollection(Collection<Event> eventCollection) {
        this.eventCollection = eventCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Weatherinformation)) {
            return false;
        }
        Weatherinformation other = (Weatherinformation) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Weatherinformation[ id=" + id + " ]";
    }
    
}
